const $http = window.$http
// 获取租户详细信息
export function getTenantDetail(tenantId) {
  return $http.request({ url: `/ucenter/tenant/get/${tenantId}` })
}

// 获取租户下的所有船舶信息
export function getTenantShips(tenantId) {
  return $http.request({
    url: '/ucenter/tenantShip/getShipByTenantId',
    params: { tenantId }
  })
}

// 获取租户下的所有船舶树结构
export function getTenantShipTree(tenantId) {
  return $http.request({
    //url: "/ops/deviceCamera/getTenantShipTree",
    url: '/supervise/tenant/getShipTree',
    params: { tenantId }
  })
}

// 获取租户下的所有船舶树结构
export function getNewTenantShipTree(tenantId) {
  return $http.request({
    //url: "/ops/deviceCamera/getTenantShipTree",
    url: '/supervise/tenant/newGetShipTree',
    params: { tenantId }
  })
}

// 获取船舶航次信息
export function getShipVoyageInfo(params) {
  return $http.request({
    url: '/voyage/voyage/command/getLastCommandByShipId', // tenantId=xxx&shipId=xxx
    params
  })
}

// 获取船舶最新状态（动态报状态）
export function getLastStatusByShipId(shipId) {
  return $http.request({
    url: '/voyage/voyage/dynamic/getLastTypeByShipId', // tenantId=xxx&shipId=xxx
    params: { shipId }
  })
}

// 查询船舶当前航次状态
export function getCurrentShipVoyageInfo(tenantId, shipId) {
  return $http.request({
    url: `/voyage/ship/voyage/current/${tenantId}/${shipId}` // tenantId=xxx&shipId=xxx
  })
}

// 查询船舶当前历史航次
export function getShipVoyageHis(tenantId, shipId) {
  return $http.request({
    url: `/voyage/ship/voyage/history/${tenantId}/${shipId}` // tenantId=xxx&shipId=xxx
  })
}

// 查询船舶历史轨迹
export function getShipLocationHis(params) {
  return $http.request({
    url: `/collector/ship/travel/queryShipTravel`,
    params
  })
}

// 根据租户id和船舶id查询对应船舶信息接口
export function getShipInfoDetail(tenantId, shipId) {
  return $http.request({
    url: `/platform/ship/queryCurrentShipInfo/${tenantId}/${shipId}` // tenantId=xxx&shipId=xxx
  })
}

// 获取我的船舶
export function getMyShips(params) {
  return $http.request({
    url: `/company/ship/myShip`,
    params
  })
}

// 根据船舶id查询该船舶的短报文 shipId
export function getTextMessageByShipId(params) {
  return $http.request({
    url: `/file/textMessage/getTextMessageByShipId`,
    params
  })
}

// 统计综合油耗 shipId
export function getStatisticOil(params) {
  return $http.request({
    url: `/voyage/voyage/dynamic/getStatisticOil`,
    params
  })
}
// 船舶证书统计 shipId
export function getStatisticShipCert(params) {
  return $http.request({
    url: `/cert/ship/cert/getStatisticShipCert`,
    params
  })
}

// 船员统计 shipId
export function getStatisticCrew(params) {
  return $http.request({
    url: `/crew/crew/getStatisticCrew`,
    params
  })
}

// 搜索船舶
export function queryShipLocations(params) {
  return $http.request({
    url: `/transmission/ship/location/query`,
    method: 'POST',
    data: params
  })
}

// 查询报警船舶
export function queryWarnShips(params) {
  return $http.request({
    url: `/transmission/ship/location/queryList`,
    method: 'POST',
    data: params
  })
}

// 获取单个船的位置详情数据
export function getShipLocationDetail(params) {
  return $http.request({
    url: `/transmission/ship/location/query/accuracy`,
    params: params
  })
}

// 获取监控报警列表
export function getVideoWarnList(params) {
  return $http.request({
    url: '/warnings/warning/getByList',
    params: params
  })
}
